﻿@model IQueryable<Project.Database.Advert>
@{
    ViewBag.Title = "List";
}
@if (Model.Count() == 0)
{
    <b>No adverts have been added yet...</b>
}
else
{

    <div class="container_12">
        <h2>
            List</h2>
        <table>
            <tr>
                <th>
                    Name
                </th>
                <th>
                    Brand name
                </th>
                <th>
                    Keywords
                </th>
                <th>
                    Timestamp
                </th>
                <th>
                    Clicks
                </th>
                <th>
                    Image
                </th>
                <th>
                </th>
            </tr>
            @foreach (var item in Model)
            {
                <tr>
                    <td>
                        @Html.DisplayFor(modelItem => item.Name)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Advertiser.BrandName)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Keywords)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Timestamp)
                    </td>
                    <td>
                        @Html.DisplayFor(modelItem => item.Clicks.Count)
                    </td>
                    <td>
                        <img src= "@Url.Content(item.URL)" alt="Advert Image" width="item.AdType.Width" height="item.AdType.Height" />
                    </td>
                    <td>
                        @Html.ActionLink("+ Add to my blog", "AddAdvert", "Blog", new { aid = item.ID, bid = 11 }, null)
                    </td>
                </tr>
            }
        </table>
    </div>
    
}
